package com.example.sxt_practise.IO;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * Read
 * @author gaofeng
 * @date 2022年05月08日 16:58
 */
public class RedaTest {
    public static void main(String[] args) {
        // 1.创建源
        File destDir = new File("dir/test2/song3.txt");
        // 2.选择流
        Reader reader = null ;
        try {
            reader = new FileReader(destDir) ;
            char[] flush = new char[1024] ;
            int len = -1 ;
            while ((len = reader.read(flush)) != -1) {
                String str = new String(flush, 0, len) ;
                System.out.println(str);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
